﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace common {
	public class base64_encoding {
		public static string encode_base64 (string src) {
			return encode_base64(src, "GB2312");
		}

		public static string encode_base64 (string src, string encode) {
			return Convert.ToBase64String(Encoding.GetEncoding(encode).GetBytes(src));
		}

		public static string decode_base64 (string src) {
			return decode_base64(src, "GB2312");
		}

		public static string decode_base64 (string src, string encode) {
			return Encoding.GetEncoding(encode).GetString(Convert.FromBase64String(src));
		}
	}
}
